Data Structure Libraries in C++.
----------------------------
// This C++ code not runDocumentation : DSACPP

Return multiple values.
Assign multiple values to multiple variables.
Alternative to struct.
The more tuple types declared, the larger the program source code.
Don't have support iterator.
Search with keyword : Variadic Templates.

Learning from Python's 'range' class.
For loop with 'range', easy to used.
Speed up for loop with reference variable.
Search with keyword : Range of Python.

Create heap from any container.
Sort any container using heap.
Build-heap with static method.
Search with keyword : Heap Array.

Containers operate on the principle of last in, first out.
Stores a linked list of variables of the same type.
Alternative to recursion.
Depth First Search.
Search with keyword : Stack.

Containers operate on the principle of first in, first out.
Stores a linked list of variables of the same type.
Breadth First Search.
Search with keyword : Queue.

Stores a contiguous sequence of variables of the same type.
Support important methods on Array List.
Speed up methods involving swap.
Search with keyword : Dynamic Array.

Stores a key and value pair.
Allow access to attributes, can change value.
Used in map.
Search with keyword : Pair in C++.

Are containers that store unique elements following a ascending order.
Allow access to element by index.
Fast insert, delete and search speed.
Support iterator.
Search with keyword : B+ Tree.

Are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.
Allow access to element by key or index.
Fast insert, delete and search speed.
Support iterator.
Search with keyword : B+ Tree.

Are containers that store unique elements in no particular order, and which allow for fast retrieval of individual elements based on their value.
Fast insert, delete and search very speed.
Support iterator.
Don't have support access to element by index.
Search with keyword : Hash Table.

Are associative containers that store elements formed by the combination of a key value and a mapped value, and which allows for fast retrieval of individual elements based on their keys.
Fast insert, delete and search very speed.
Support iterator.
Allow access to element by key.
Don't have support access to element by index.
Search with keyword : Hash Table.
Documentation : Tuple
[Back] [Source]
Cannot change the value of elements inside the tuple.

Return a tuple containing different values.

Use the 'convert' method to assign values to multiple variables, the number of variables equal to the number of elements in the tuple.

Use the 'convert' method to swap in any order.
Documentation : Range
[Back] [Source]
With start = 0, end = 5, step = 2.

Documentation : Heap
[Back] [Source]
Don't name the variable 'heap' because there is already a class named 'heap'.
The cost of creating heap from another container is O(n log n), but O(n) if that is the best case.

Time complexity of creating heap from another container is O(n log n), but O(n) if that is the best case.

Build min heap by static method of heap class using less_than function, time complexity is O(n log n) or O(n).

| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(n) | O(log n) | O(1) |
| pop | O(n) | O(log n) | |
| try_pop | O(n) | O(log n) | |
| top | O(1) | ||
| clear | O(n) | ||
| out | O(n) | ||
| empty | O(1) | ||
| swap | O(1) | ||
| operator bool | O(1) | ||
| operator= | O(n) | O(1) | |
| operator>> | O(n) | O(log n) | O(1) |
| operator<< | O(n) | O(log n) | |
| begin | O(1) | ||
| end | O(1) | ||
| rbegin | O(1) | ||
| rend | O(1) | ||
| cbegin | O(1) | ||
| cend | O(1) | ||
| crbegin | O(1) | ||
| crend | O(1) | ||
Documentation : Stack
[Back] [Source]
The last input element is added to the top.


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(1) | ||
| pop | O(1) | ||
| try_pop | O(1) | ||
| top | O(1) | ||
| clear | O(n) | ||
| out | O(n) | ||
| empty | O(1) | ||
| swap | O(1) | ||
| operator bool | O(1) | ||
| operator= | O(n) | O(1) | |
| operator>> | O(1) | ||
| operator<< | O(1) | ||
| begin | O(1) | ||
| end | O(1) | ||
Documentation : Queue
[Back] [Source]
The last input element is added at the end.


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(1) | ||
| pop | O(1) | ||
| try_pop | O(1) | ||
| top | O(1) | ||
| bottom | O(1) | ||
| clear | O(n) | ||
| out | O(n) | ||
| empty | O(1) | ||
| swap | O(1) | ||
| operator bool | O(1) | ||
| operator= | O(n) | O(1) | |
| operator>> | O(1) | ||
| operator<< | O(1) | ||
| begin | O(1) | ||
| end | O(1) | ||
Documentation : Array List
[Back] [Source]
Time complexity of creating heap from another container is O(n).
Create Array List from any container by using iterator of this container, time complexity depends on the speed of that iterator.

Time complexity of creating heap from another container is O(n).
Create Array List from any container by using iterator of this container, time complexity depends on the speed of that iterator.

| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(n + k) | O(k) | |
| pushBack | O(n) | O(1) | |
| pushFront | O(n) | ||
| pushAt | O(n + k) | O(k) | |
| popBack | O(n) | O(1) | |
| popFront | O(n) | ||
| popAt | O(n + k) | O(k) | |
| pop | O(n) | ||
| popAll | O(n) | ||
| popIn | O(n) | ||
| indexOf | O(n) | ||
| binSearch | O(log n) | ||
| reverse | O(n) | ||
| memset | O(n) | ||
| clear | O(n) | ||
| swap | O(1) | ||
| count | O(n) | ||
| foreach | O(n) | ||
| selectIf | O(n) | ||
| all | O(n) | ||
| any | O(n) | ||
| sort | O(n2) | O(n log n) | |
| out | O(n) | ||
| len | O(1) | ||
| empty | O(1) | ||
| operator bool | O(1) | ||
| operator= | O(n) | O(1) | |
| operator+= | O(n) | ||
| operator+ | O(n) | ||
| begin | O(1) | ||
| end | O(1) | ||
| rbegin | O(1) | ||
| rend | O(1) | ||
| cbegin | O(1) | ||
| cend | O(1) | ||
| crbegin | O(1) | ||
| crend | O(1) | ||
Documentation : Pair
[Back] [Source]
Attributes of Pair are 'key' and 'value', you can change value of these.
Documentation : Set
[Back] [Source]
Elements in ascending order, don't duplicates.
Time complexity of creating Set from other Set is O(n).


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(log n) | ||
| pop | O(log n) | ||
| contains | O(log n) | ||
| clear | O(n) | ||
| swap | O(1) | ||
| out | O(n) | ||
| empty | O(1) | ||
| len | O(1) | ||
| operator bool | O(1) | ||
| operator[] | O(log n) | ||
| operator() | O(log n) | ||
| operator= | O(n) | O(1) | |
| begin | O(1) | ||
| end | O(1) | ||
| rbegin | O(1) | ||
| rend | O(1) | ||
| cbegin | O(1) | ||
| cend | O(1) | ||
| crbegin | O(1) | ||
| crend | O(1) | ||
Documentation : Map
[Back] [Source]
Elements in ascending order by key, don't key duplicates.
Time complexity of creating Map from other Map is O(n).


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(log n) | ||
| pop | O(log n) | ||
| contains | O(log n) | ||
| clear | O(n) | ||
| swap | O(1) | ||
| out | O(n) | ||
| empty | O(1) | ||
| len | O(1) | ||
| operator bool | O(1) | ||
| operator[] | O(log n) | ||
| operator() | O(log n) | ||
| operator= | O(n) | O(1) | |
| begin | O(1) | ||
| end | O(1) | ||
| rbegin | O(1) | ||
| rend | O(1) | ||
| cbegin | O(1) | ||
| cend | O(1) | ||
| crbegin | O(1) | ||
| crend | O(1) | ||
Documentation : Hash Set
[Back] [Source]
Time complexity of creating Hash Set from another container is O(n).


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(n) | O(1) | |
| pop | O(n) | O(1) | |
| contains | O(n) | O(1) | |
| clear | O(n) | ||
| swap | O(1) | ||
| out | O(n) | ||
| empty | O(1) | ||
| len | O(1) | ||
| operator bool | O(1) | ||
| operator[] | O(n) | O(1) | |
| operator= | O(n) | O(1) | |
| begin | O(n) | O(1) | |
| end | O(1) | ||
| rbegin | O(n) | O(1) | |
| rend | O(1) | ||
| cbegin | O(n) | O(1) | |
| cend | O(1) | ||
| crbegin | O(n) | O(1) | |
| crend | O(1) | ||
Documentation : Hash Map
[Back] [Source]
Time complexity of creating Hash Set from another container is O(n).


| Methods | Time Complexity | ||
|---|---|---|---|
| Worst | Average | Best | |
| push | O(n) | O(1) | |
| pop | O(n) | O(1) | |
| contains | O(n) | O(1) | |
| clear | O(n) | ||
| swap | O(1) | ||
| out | O(n) | ||
| empty | O(1) | ||
| len | O(1) | ||
| operator bool | O(1) | ||
| operator[] | O(n) | O(1) | |
| operator= | O(n) | O(1) | |
| begin | O(n) | O(1) | |
| end | O(1) | ||
| rbegin | O(n) | O(1) | |
| rend | O(1) | ||
| cbegin | O(n) | O(1) | |
| cend | O(1) | ||
| crbegin | O(n) | O(1) | |
| crend | O(1) | ||
Overlord Opening IV
00:00 -